<?php

namespace app\controllers;

use Yii;
use yii\web\Controller;
use yii\web\Request;
use yii\web\Response;
use proxy\HttpProxy;
use helper\SessionHelper;

class GoodsController extends SecBaseController
{
    public function actionList(){
        $request = Yii::$app->request;

        $page_code = $request->get('page_code');
        $sort_code = $request->get('sort_code');
        $sortorder = $request->get('sortorder');
        $this->remote_params['page_code'] = $page_code;
        $this->remote_params['sort_code'] = $sort_code;
        $this->remote_params['sortorder'] = $sortorder;
        
        $vender_id = $request->get('vender_id');
        $goods_type = $request->get('goods_type');
        $is_share_card = $request->get('is_share_card');
        $goods_name = $request->get('goods_name');


        $this->remote_params['vender_id'] = $vender_id;
        $this->remote_params['goods_type'] = $goods_type;
        $this->remote_params['is_share_card'] = $is_share_card;
        $this->remote_params['goods_name'] = $goods_name;

        try{ 
            $ret = $this->proxy->execute('goods', 'list', $this->remote_params);
            $this->return_page_values = array_merge($this->return_page_values, $ret);
        }catch(\Exception $e){
            $this->return_page_values['errno'] = $e->getCode();
            $this->return_page_values['errmsg'] = $e->getMessage();
            return $this->myRenderFile('@tpl/page/error.tpl', $this->return_page_values);
        }

        return $this->myRenderFile('@tpl/page/goods/list.tpl', $this->return_page_values);

    }

    
}
